<?php

class myUser extends sfGuardSecurityUser
{
	public function getAlbum($albumId){
		if($albumId == null)
			return $this->getGuardUser()->getMainAlbum();
		else
			return Doctrine::getTable('Album')->find($albumId);
	}
	
	public function getId(){
		return $this->getGuardUser()->getId();
	}
	
	public function getTaskList($start,$end){
		return $this->getGuardUser()->getTaskList($start,$end);
	}
	
	public function getGroup($group){
		if(is_string($group)){
			$groups = Doctrine::getTable('aclGroup');
			$groups = $groups->findByDql('group_name = ? AND owner = ?', array($group,$this->getId()));
			$group = $groups->getFirst();
		}
		
		if($group instanceof aclGroup)
			return $group;
		else
			return null;
	}
	
	public function getWidgetsPositions($sectionName)
	{
		
		return $this->getGuardUser()->getWidgetsPositions($sectionName);
	}

	//public function authenticate($
/*	public function canRead($ACLelement){
		$sql = "SELECT grant,deny FROM sf_acl_".$ACLelement->getType()."_read
			JOIN group_id USING (group_id)
			//WHERE element_id = ".$ACLelement->getUuid()." and group_id IN (SELECT group_id FROM sf_acl_groups WHERE user_id = ".$this->getId();
			GROUP BY element_id,user_id
			HAVING sum(
			WHERE element_id = ".$ACLelement->getUuid()." and user_id = ".$this->getId();

				
		echo "nada";
	}*/
}
